<?php
class Order_send_model extends CI_Model
{
    private $table = 'order_send';
   
   /**
    * 批量添加  推送订单
    */
    public function addBatch($orderIds, $macs){
        $data = array();
        foreach ($macs as $value) {
            foreach ($orderIds as $key => $order) {
                if ($value->order_id > $order) {
                    $data[] = array(
                        'order_id' => $order,
                        'mac_id'   => $value->mac_id,
                        'flag'     => 0
                    );
                }
            }
        }
        if ( ! empty($data)) {
            $this->db->insert_batch($this->table, $data);
        }
    }
}